package com.xyazm.wms.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 出库状态
 */
public enum DeliveryOrderStatusEnum {

    INIT(0, "初始化"),
    CANCEL(1, "取消");

    private Integer code;

    private String msg;

    DeliveryOrderStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static Map<Integer, String> toMap(){
        Map<Integer, String> map = new HashMap<>(16);
        for (DeliveryOrderStatusEnum element : DeliveryOrderStatusEnum.values() ){
            map.put(element.getCode(),element.getMsg());
        }
        return map;
    }

    public static DeliveryOrderStatusEnum getByCode(Integer code){
        for(DeliveryOrderStatusEnum element : DeliveryOrderStatusEnum.values()){
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }
}
